package oj;

import java.util.Scanner;

public class Day40F {
    public static void main(String[] args){
        long[] D=new long[21];
        D[0]=D[1]=0;
        D[2]=1;
        for(int i=3;i<21;i++){
            D[i]=(i-1)*(D[i-1]+D[i-2]);
        }
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            int n=sc.nextInt();
            System.out.println(D[n]);
        }
    }
}
